package com.jiangyg.mall.coupon.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiangyg.mall.coupon.entity.HomeAdv;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 类描述：首页轮播广告
 *
 * @author jiangyg
 * @email email@jiangyg.com
 * @date 2021-10-18 21:33:06
 */
@Mapper
public interface HomeAdvDao extends BaseMapper<HomeAdv> {

    /**
     * 功能描述：累计广告点击次数
     *
     * @param id         广告ID
     * @param clickCount 累计次数
     * @return 修改广告条数
     */
    @Update("update mc_home_adv set click_count = ifnull(click_count, 0) + #{clickCount} where id = #{id}")
    int updateClickCount(@Param("id") Long id, @Param("clickCount") Long clickCount);

}
